<?php echo $header; ?>
<div id="content">
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    <?php if ($error_warning) { ?>
    <div class="warning"><?php echo $error_warning; ?>
        <div id="success"></div>
    </div>
    <?php } ?>
    <div class="box">
        <div class="heading">
            <h1><img src="view/image/module.png" alt="" /> <?php echo $heading_title; ?></h1>
        </div>
    </div>
</div>


<div id="success"></div>


<div class="content">

    <table id="module" class="">
        <thead>
            <tr>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><div id="name"><?php echo $product['name'] ?></div></td>
                <td><a href="<?php  echo $product['next'] ?>" class="button"><?php echo $button_next; ?></a></td>
                <td></td>
            </tr>
            <tr>
                <td>
                    <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
                        <input type="text" name="searchtext" value="<?php echo $searchtext ?>" style="width:600px" id="search" />
                        <input type="hidden" name="id" value="<?php echo $product['product_id']; ?>" />
                    </form>

                </td>
                <td><a onclick="$('#form').submit();" class="button" ><?php echo $button_search; ?></td>
                <td></td>
            </tr>


            <?php
            $i=0;
            foreach ($product['img_link'] as $link){
            if ($i===0){
            echo '<tr>';
                }
                ?>
                <td>
                    <a onclick="send('<?php echo $link['href'] ?>')"><img src="<?php echo $link['href']; ?>" alt=""></a>
                </td>
                <?php

                $i++;

                if ($i===3){ 
                echo '</tr>';
            $i=0;
            }
            }

            ?>

        </tbody>
    </table> 

</div>
<script type="text/javascript">
    function send(link){
    
    
    $.ajax({
    type: 'post',
    url: 'index.php?route=module/parseimage/getimage&getimage='+link+'&id=<?php echo $product["product_id"]; ?>&token=<?php echo $token;?>',
    dataType: 'html',
    data: $('#product :input'),
    success: function (html) {
    $('#success').append('<div class="success">'+html+'</div>');
}

});

};
    
</script>

<?php echo $footer; ?>